from django.contrib import admin
from apps.games.models import LivePlatformInfoModel, PkModeInfoModel, LiveRoomInfoModel, PkDetailInfoModel


# Register your models here.


class LivePlatformInfoAdmin(admin.ModelAdmin):
    """
    直播平台信息管理类
    """
    list_display = ['id', 'name', 'desc', 'creator', 'is_access', 'expand_json', 'checker', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'desc', 'creator', 'is_access', 'expand_json', 'checker', 'created_time']
    list_filter = ['id', 'name', 'desc', 'creator', 'is_access', 'expand_json', 'checker', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'desc', 'creator', 'is_access', 'expand_json', 'checker', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class PkModeInfoAdmin(admin.ModelAdmin):
    """
    竞赛模式信息管理类
    """
    list_display = ['id', 'name', 'rule', 'creator', 'is_access', 'checker', 'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'name', 'rule', 'creator', 'is_access', 'checker', 'expand_json', 'created_time']
    list_filter = ['id', 'name', 'rule', 'creator', 'is_access', 'checker', 'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name', 'rule', 'creator', 'is_access', 'checker', 'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class LiveRoomInfoAdmin(admin.ModelAdmin):
    """
    直播间信息管理类
    """
    list_display = ['id', 'live_room_number', 'streamer', 'live_platform', 'subject', 'label', 'pk_mode',
                    'current_question_no', 'status', 'expand_json', 'created_time']
    ordering = ('id',)
    fields = ['id', 'live_room_number', 'streamer', 'live_platform',
              'subject', 'label', 'pk_mode', 'current_question_no', 'status', 'expand_json', 'created_time']
    list_filter = ['id', 'live_room_number', 'streamer', 'live_platform',
                   'subject', 'label', 'pk_mode', 'current_question_no', 'status', 'expand_json', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'live_room_number', 'streamer', 'live_platform',
                     'subject', 'label', 'pk_mode', 'current_question_no', 'status', 'expand_json', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class PkDetailInfoAdmin(admin.ModelAdmin):
    """
    竞赛详细信息管理类
    """
    list_display = ['id', 'live_room_number', 'streamer', 'player', 'question', 'rank', 'use_time', 'is_right']
    ordering = ('id',)
    fields = ['id', 'live_room_number', 'streamer', 'player', 'question', 'rank', 'use_time', 'is_right']
    list_filter = ['id', 'live_room_number', 'streamer', 'player', 'question', 'rank', 'use_time', 'is_right']
    # 外键不能成为搜索字段
    search_fields = ['id', 'live_room_number', 'streamer', 'player', 'question', 'rank', 'use_time', 'is_right']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


admin.site.register(LivePlatformInfoModel, LivePlatformInfoAdmin)
admin.site.register(PkModeInfoModel, PkModeInfoAdmin)
admin.site.register(LiveRoomInfoModel, LiveRoomInfoAdmin)
admin.site.register(PkDetailInfoModel, PkDetailInfoAdmin)
